//
//  PKPDFAnnotation.m
//  PDFKitTest
//
//  Created by Emo, on 2024/1/24.
//

#import "PKPDFAnnotation.h"

@implementation PKPDFAnnotation

- (void)drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context {
    [super drawWithBox:box inContext:context];
    
    UIGraphicsPushContext(context);
    CGContextSaveGState(context);
    
    if (self.path) {
        [self.color setStroke];
        [self.path stroke];
        
    } else if (self.image) {
        
        PDFRect rect = [self.page boundsForBox:box];
        CGContextDrawImage(context, rect, [self.image CGImage]);
    }

    CGContextRestoreGState(context);
    UIGraphicsPopContext();
}

@end
